package com.jzy.bxb.app.scripts.http.user;

import java.util.Date;

import com.jzy.bxb.app.server.AuthHttpHandler;
import com.jzy.bxb.core.handler.HandlerEntity;
import com.jzy.bxb.model.mongo.dao.SuggestDao;
import com.jzy.bxb.model.mongo.entity.Suggest;

/**
 * 建议与反馈
 * 
 * <p>
 * http://127.0.0.1:8680/user/suggest?suggest=hello&sid=e8554461-b5e0-4c28-8bcc-1d2c1f316d3a
 * http://112.74.36.233:8680/user/suggest?suggest=hello&sid=2a122633-1ef0-4640-ba7d-fe57beb6759f
 * </p>
 *
 * @author JiangZhiYong
 * @date 2017-07-04 QQ:359135103
 */
@HandlerEntity(path = "/user/suggest")
public class SuggestHandler extends AuthHttpHandler {

	@Override
	public void run() {
		String info = getString("suggest");
		if (info == null || "".equals(info.trim())) {
			sendError("建议信息为空");
		}
		Suggest suggest = new Suggest();
		suggest.setInfo(info);
		suggest.setUserId(getUser().getId());
		suggest.setTime(new Date());
		SuggestDao.saveSuggest(suggest);
		sendMsg(suggest);

	}

}
